<template>
	<view class="container">
		<uni-section title="通栏卡片" type="line">
			<uni-card :title="business.nickname" :isFull="true" :sub-title="business.intro ? business.intro : '这家伙很懒，什么也没写！'" :extra="msg.createtime_text" :thumbnail="avatar">
				<text class="uni-body">{{msg.content}}</text>
			</uni-card>
		</uni-section>
	</view>
</template>

<script>
    import UniCard from '@/uni_modules/uni-card/components/uni-card/uni-card.vue';
	export default {
		components: {UniCard},
        onLoad(options){
            this.msgid = options.msgid ? options.msgid : 0

            this.BusinessData()
            this.MsgInfoData()
        },
		data() {
			return {
                business:{},
                msgid: 0,
                msg:{},
				avatar: '/static/logo.png',
				extraIcon:{
					color: '#4cd964',
					size: '22',
					type: 'gear-filled'
				}
			}
		},
		methods: {
			async BusinessData(){
                var data = {
                    msgid: this.msgid
                }
                // console.log(data);

                var result = await uni.$u.http.post('/business/infobus',data)

                if(result.code == 0){
                    this.$refs.notice.show({
                        type: 'error',
                        message: result.msg
                    })
                    return false
                }else{
                    this.business = result.data

                    this.avatar = result.data.avatar_text ? result.data.avatar_text :'/static/logo.png'
                }
            },
            async MsgInfoData(){
                var data = {
                    msgid: this.msgid
                }

                var result = await uni.$u.http.post('/business/msginfo',data)

                if(result.code == 0){
                    this.$refs.notice.show({
                        type: 'error',
                        message: result.msg
                    })
                    return false
                }else{
                    this.msg = result.data
                }
            }
		}
	}
</script>

